/**
 * 2017年9月28日
 */
package exp.util;

import java.util.ArrayList;

import weka.core.Attribute;
import weka.core.Instances;

/**
 * @author Alex
 *
 */
public class DatasetsUtil {
	public static String[] problems = { "FiftyWords", "Adiac", "Beef", "CBF", "ChlorineConcentration", "CinCECGtorso",
			"Coffee", "CricketX", "CricketY", "CricketZ", "DiatomSizeReduction", "ECG", "ECGFiveDays", "FaceAll",
			"FaceFour", "FacesUCR", "Fish", "GunPoint", "Haptics", "InlineSkate", "ItalyPowerDemand", "Lightning2",
			"Lightning7", "Mallat", "MedicalImages", "MoteStrain", "NonInvasiveFetalECGThorax1",
			"NonInvasiveFetalECGThorax2", "OliveOil", "OSULeaf", "SonyAIBORobotSurface1", "SonyAIBORobot Surface2",
			"StarLightCurves", "SwedishLeaf", "Symbols", "Synthetic Control", "Trace", "TwoLeadECG", "TwoPatterns",
			"UWaveGestureLibraryX", "UWaveGestureLibraryY", "UWaveGestureLibraryZ", "Wafer", "WordsSynonyms", "Yoga" };


	public static String names [] = new String[]{
			"Car","CBF","Coffee","Cricket","ECG200","FISH","Gun_Point"
	};
	public static String trainSuffix = "_TRAIN";
	public static String testSuffix = "_TEST";

	public static Instances initInstancesWithParmas(String name,int numFeaturesWithOutClassAtt,String attPrefix,int numInstance,boolean withClassAttribute,Attribute classAttribute){
		ArrayList<Attribute> atts = new ArrayList<>(numFeaturesWithOutClassAtt);
		for(int i =0;i<numFeaturesWithOutClassAtt;i++){
			atts.add(new Attribute(attPrefix+i));
		}
		if(withClassAttribute){
			if(classAttribute == null){
				throw new RuntimeException("class attribute shouldn't be null");
			}
			atts.add(classAttribute);
		}
		Instances insts = new Instances(name, atts, numInstance);
		if(withClassAttribute){
			insts.setClassIndex(insts.numAttributes()-1);
		}
		return insts;
	}
	
//	public static Instances fillInstancesWithFeatureVecotors(List<Feature>){
//		ArrayList<Attribute> atts = new ArrayList<>(numFeaturesWithOutClassAtt);
//		for(int i =0;i<numFeaturesWithOutClassAtt;i++){
//			atts.add(new Attribute(attPrefix+i));
//		}
//		if(withClassAttribute){
//			if(classAttribute == null){
//				throw new RuntimeException("class attribute shouldn't be null");
//			}
//			atts.add(classAttribute);
//		}
//		Instances insts = new Instances(name, atts, numInstance);
//		if(withClassAttribute){
//			insts.setClassIndex(insts.numAttributes()-1);
//		}
//		return insts;
//	}
	
}
